/**
 * DownloadProduct 业务逻辑实现类
 * @author yanwl
 * @date 2014-08-25
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.DownloadProduct;
import com.chnbst.bstyun.model.pojo.Product;
import com.chnbst.bstyun.service.DownloadProductService;

@Transactional
@Service
public class DownloadProductServiceImpl extends BaseService implements DownloadProductService {
	
	//声明日志对象 logback
	private final static Logger logger = LoggerFactory.getLogger(DownloadProductServiceImpl.class);
	private final static String nameSpace = "com.chnbst.bstyun.mapper.DownloadProductMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteDownloadProduct(Integer downloadProductId) {
		return DaoHelper.delete(nameSpace, "deleteDownloadProduct", downloadProductId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertDownloadProduct(DownloadProduct downloadProduct) {
		return DaoHelper.insert(nameSpace, "insertDownloadProduct", downloadProduct);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateDownloadProduct(DownloadProduct downloadProduct) {
		return DaoHelper.update(nameSpace, "updateDownloadProduct", downloadProduct);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public DownloadProduct selectDownloadProductByDownloadProductId(Integer downloadProductId) {
		return (DownloadProduct)DaoHelper.query(nameSpace, "selectDownloadProductByDownloadProductId", downloadProductId);
	}
	
	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<Product> selectDownloadProducts(Map<String, Object> map) {
		return (List<Product>)DaoHelper.list(nameSpace, "selectDownloadProducts", map);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public int selectDownloadProductCount(Map<String, Object> map) {
		return DaoHelper.count(nameSpace, "selectDownloadProductCount", map);
	}
}
